﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Wicresoft.SMS.Data;
using System.ComponentModel.DataAnnotations;
using Wicresoft.SMS.Web.App_GlobalResources;

namespace Wicresoft.SMS.Web
{
    public class CommonUseBannerModel : BaseModelWithAuthorise
    {
        public string UserAilas { get; set; }
        public string UserDisplayName { get; set; }
        public int UserId { get; set; }
        public string UserDepartmentDisplayName { get; set; }
        public string UserRoleNames { get; set; }
        public bool IsZHCN { get; set; }
        public string Url { get; set; }
        public CommonUseBannerModel(User user)
        {
            if (user != null){
                UserAilas = user.CIL;
                UserDisplayName = user.NameEN;
                UserId = user.UserID;
                UserDepartmentDisplayName = user.Department.DepartmentName;
                foreach (var role in user.Role){
                    UserRoleNames = UserRoleNames + role.RoleName + ",";
                }
                UserRoleNames = UserRoleNames.Substring(0, UserRoleNames.Length - 1);
            }
        }

        [AuthoriseImplement(typeof(OnlyCheckVisibleImpIAuthorise))]
        [AuthoriseFlag(AuthoriseFlag.page_home_setting)]
        [Display(Name="user_banner_link_setting" , ResourceType=typeof(Resources))]
        public string LinkSettings { get; set; }

    }
}